#ex10
import glob


def get_py_list(path):
    return glob.glob(path + "\\*.py")      #take .py for example


def get_num(py_list):
    blank_line_num = 0
    comm_line_num = 0
    code_line_num = 0
    for file in py_list:
        content = open(file, "r", encoding="utf8")
        for line in content:
            if not line.strip():
                blank_line_num += 1
            elif line.startswith("#"):
                comm_line_num += 1
            else:
                code_line_num += 1
    print("总共编写多少行代码：%s" % code_line_num)
    print("注释行为：%s" % comm_line_num)
    print("空白行为：%s" % blank_line_num)